<?php

namespace App\Http\Requests\App;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property int category_id
 * @property int|null brand_id
 * @property int|null brand_series_id
 */
class ProductIndexRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'category_id'     => 'required|int|min:1',
            'brand_id'        => 'sometimes|int|min:1',
            'brand_series_id' => 'sometimes|int|min:0', // 兼容旧版无品牌系列的客户
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'category_id.*' => '商品类别的编号必须是大于0的数字'
//        ];
//    }
}
